package com.mindskip.xzs.domain.enums;

import java.util.stream.Stream;

public enum ExamUserStatusEnum {

    NOTICED(0, "已通知"),
    ING(1, "正考"),
    DONE(2, "已考");

    Integer code;
    String name;



    ExamUserStatusEnum(Integer code, String name) {
        this.code = code;
        this.name = name;
    }

    public Integer getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public static ExamUserStatusEnum of(int code) {
        return Stream.of(ExamUserStatusEnum.values())
                .filter(it -> it.getCode() == code)
                .findFirst()
                .orElseThrow(() -> new IllegalArgumentException("未找到该枚举类型：" + code));
    }
}
